package iron.data;

import kha.graphics4.VertexBuffer;
import kha.graphics4.IndexBuffer;
import kha.graphics4.Usage;
import kha.graphics4.VertexStructure;
import kha.graphics4.VertexData;

class ConstData {

	public static var screenAlignedVB: VertexBuffer = null;
	public static var screenAlignedIB: IndexBuffer = null;
	#if (rp_decals || rp_probes)
	public static var boxVB: VertexBuffer = null;
	public static var boxIB: IndexBuffer = null;
	#end
	#if arm_deinterleaved
	public static var skydomeVB: Array<VertexBuffer> = null;
	#else
	public static var skydomeVB: VertexBuffer = null;
	#end
	public static var skydomeIB: IndexBuffer = null;

	public static function createScreenAlignedData() {
		// Over-sized triangle
		var data = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0];
		var indices = [0, 1, 2];

		// Mandatory vertex data names and sizes
		var structure = new VertexStructure();
		structure.add("pos", VertexData.Float2);
		screenAlignedVB = new VertexBuffer(Std.int(data.length / Std.int(structure.byteSize() / 4)), structure, Usage.StaticUsage);
		var vertices = screenAlignedVB.lock();
		for (i in 0...vertices.length) vertices.set(i, data[i]);
		screenAlignedVB.unlock();

		screenAlignedIB = new IndexBuffer(indices.length, Usage.StaticUsage);
		var id = screenAlignedIB.lock();
		for (i in 0...id.length) id[i] = indices[i];
		screenAlignedIB.unlock();
	}

	#if (rp_decals || rp_probes)
	public static function createBoxData() {
		var data = [
			-1.0,1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,-1.0,1.0,1.0,-1.0,
			1.0,1.0,1.0,1.0,1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,
			1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,-1.0,
			1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,-1.0,1.0,-1.0,1.0,1.0,-1.0,1.0,-1.0,
			-1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0
		];
		var indices = [
			0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,
			18,19,20,21,22,20,22,23
		];

		var structure = new VertexStructure();
		structure.add("pos", VertexData.Float3);
		boxVB = new VertexBuffer(Std.int(data.length / Std.int(structure.byteSize() / 4)), structure, Usage.StaticUsage);
		var vertices = boxVB.lock();
		for (i in 0...vertices.length) vertices.set(i, data[i]);
		boxVB.unlock();

		boxIB = new IndexBuffer(indices.length, Usage.StaticUsage);
		var id = boxIB.lock();
		for (i in 0...id.length) id[i] = indices[i];
		boxIB.unlock();
	}
	#end

	public static function createSkydomeData() {
		#if arm_deinterleaved
		var structure = new VertexStructure();
		structure.add("pos", VertexData.Float3);
		var structLength = Std.int(structure.byteSize() / 4);
		var pos = skydomePos;
		skydomeVB = [];
		skydomeVB[0] = new VertexBuffer(Std.int(pos.length / 3), structure, Usage.StaticUsage);
		var vertices = skydomeVB[0].lock();
		for (i in 0...Std.int(vertices.length / structLength)) {
			vertices.set(i * structLength, pos[i * 3]);
			vertices.set(i * structLength + 1, pos[i * 3 + 1]);
			vertices.set(i * structLength + 2, pos[i * 3 + 2]);
		}
		skydomeVB[0].unlock();
		structure = new VertexStructure();
		structure.add("nor", VertexData.Float3);
		structLength = Std.int(structure.byteSize() / 4);
		var nor = skydomeNor;
		skydomeVB[1] = new VertexBuffer(Std.int(pos.length / 3), structure, Usage.StaticUsage);
		var vertices = skydomeVB[1].lock();
		for (i in 0...Std.int(vertices.length / structLength)) {
			vertices.set(i * structLength, -nor[i * 3]); // Flip to match quad
			vertices.set(i * structLength + 1, -nor[i * 3 + 1]);
			vertices.set(i * structLength + 2, -nor[i * 3 + 2]);
		}
		skydomeVB[1].unlock();
		#else
		var structure = new VertexStructure();
		structure.add("pos", VertexData.Float3);
		structure.add("nor", VertexData.Float3);
		var structLength = Std.int(structure.byteSize() / 4);
		var pos = skydomePos;
		var nor = skydomeNor;
		skydomeVB = new VertexBuffer(Std.int(pos.length / 3), structure, Usage.StaticUsage);
		var vertices = skydomeVB.lock();
		for (i in 0...Std.int(vertices.length / structLength)) {
			vertices.set(i * structLength, pos[i * 3]);
			vertices.set(i * structLength + 1, pos[i * 3 + 1]);
			vertices.set(i * structLength + 2, pos[i * 3 + 2]);
			vertices.set(i * structLength + 3, -nor[i * 3]); // Flip to match quad
			vertices.set(i * structLength + 4, -nor[i * 3 + 1]);
			vertices.set(i * structLength + 5, -nor[i * 3 + 2]);
		}
		skydomeVB.unlock();
		#end

		var indices = skydomeIndices;
		skydomeIB = new IndexBuffer(indices.length, Usage.StaticUsage);
		var id = skydomeIB.lock();
		for (i in 0...id.length) id[i] = indices[i];
		skydomeIB.unlock();
	}

	static var skydomeIndices = [0,1,2,0,3,4,3,5,6,5,7,8,7,9,10,9,11,12,13,14,15,11,16,17,13,18,2,14,2,19,2,1,20,1,4,21,4,6,22,6,8,23,8,10,24,10,12,25,14,26,15,17,27,25,22,23,28,24,29,28,24,25,30,26,31,15,25,27,32,26,19,33,19,20,34,20,21,35,21,22,36,33,34,37,34,35,38,35,36,39,36,28,40,28,29,41,30,42,41,31,43,15,30,32,44,31,33,45,40,41,46,42,47,46,43,48,15,42,44,49,43,45,50,45,37,51,37,38,52,39,53,52,39,40,54,50,51,55,51,52,56,53,57,56,53,54,58,46,59,58,46,47,60,48,61,15,47,49,62,48,50,63,59,64,65,59,60,66,61,67,15,60,62,68,61,63,69,63,55,70,56,71,70,56,57,72,57,58,65,70,71,73,71,72,74,72,65,75,64,76,75,64,66,77,67,78,15,68,79,77,67,69,80,69,70,81,76,77,82,78,83,15,77,79,84,80,85,83,80,81,86,81,73,87,74,88,87,74,75,89,76,90,89,87,88,91,88,89,92,90,93,92,90,82,94,83,95,15,82,84,96,83,85,97,86,98,97,86,87,99,95,100,15,96,101,102,95,97,103,97,98,104,98,99,105,91,106,105,91,92,107,93,108,107,93,94,102,105,106,109,106,107,110,108,111,110,108,102,112,100,113,15,102,101,114,100,103,115,103,104,116,104,105,117,114,118,119,113,115,120,115,116,121,117,122,121,109,123,122,109,110,124,111,125,124,111,112,119,113,126,15,123,124,127,125,128,127,125,119,129,126,130,15,119,118,131,126,120,132,121,133,132,121,122,134,122,123,135,130,132,136,132,133,137,133,134,138,134,135,139,135,127,140,128,141,140,128,129,142,130,143,15,129,131,144,139,140,145,141,146,145,141,142,147,143,148,15,142,144,149,143,136,150,137,151,150,138,152,151,138,139,153,150,151,154,152,155,154,153,156,155,153,145,157,146,158,157,146,147,159,148,160,15,147,149,161,148,150,162,158,163,164,158,159,165,160,166,15,161,167,165,160,162,168,162,154,169,155,170,169,156,171,170,156,157,164,169,170,172,171,173,172,171,164,174,163,175,174,163,165,176,166,177,15,165,167,178,166,168,179,168,169,180,176,181,182,177,183,15,176,178,184,177,179,185,179,180,186,172,187,186,173,188,187,173,174,189,175,182,189,187,190,191,188,192,190,188,189,193,182,194,193,182,181,195,183,196,15,181,184,197,183,185,198,185,186,191,194,195,199,196,200,15,195,197,201,196,198,202,198,191,203,190,204,203,192,205,204,192,193,206,194,207,206,205,208,209,205,206,210,207,211,210,207,199,212,200,213,15,199,201,214,202,215,213,202,203,216,204,209,216,213,217,15,214,218,219,215,220,217,215,216,221,209,222,221,209,208,223,208,210,224,211,225,224,211,212,219,223,226,227,223,224,228,225,229,228,225,219,230,217,231,15,218,232,230,220,233,231,220,221,234,222,227,234,230,232,235,231,233,236,233,234,237,227,238,237,227,226,239,226,228,240,229,241,240,229,230,242,231,243,15,239,240,244,241,245,244,241,242,246,243,247,15,235,248,246,243,236,249,237,250,249,238,251,250,239,252,251,249,250,253,250,251,254,252,255,254,252,244,256,245,257,256,245,246,258,247,259,15,248,260,258,247,249,261,257,262,263,258,264,262,259,265,15,258,260,266,259,261,267,261,253,268,253,254,269,255,270,269,255,256,263,268,271,272,269,273,271,270,274,273,270,263,275,262,276,275,262,264,277,265,278,15,264,266,279,267,272,278,276,280,281,276,277,282,278,283,15,277,279,284,278,272,285,272,271,286,271,273,287,274,288,287,274,275,281,287,3,0,288,5,3,281,7,5,280,9,7,282,11,9,283,13,15,282,284,16,285,18,13,286,0,18,0,2,18,0,4,1,3,6,4,5,8,6,7,10,8,9,12,10,11,17,12,13,2,14,14,19,26,2,20,19,1,21,20,4,22,21,6,23,22,8,24,23,10,25,24,17,25,12,22,28,36,24,28,23,24,30,29,25,32,30,26,33,31,19,34,33,20,35,34,21,36,35,33,37,45,34,38,37,35,39,38,36,40,39,28,41,40,30,41,29,30,44,42,31,45,43,40,46,54,42,46,41,42,49,47,43,50,48,45,51,50,37,52,51,39,52,38,39,54,53,50,55,63,51,56,55,53,56,52,53,58,57,46,58,54,46,60,59,47,62,60,48,63,61,59,65,58,59,66,64,60,68,66,61,69,67,63,70,69,56,70,55,56,72,71,57,65,72,70,73,81,71,74,73,72,75,74,64,75,65,64,77,76,68,77,66,67,80,78,69,81,80,76,82,90,77,84,82,80,83,78,80,86,85,81,87,86,74,87,73,74,89,88,76,89,75,87,91,99,88,92,91,90,92,89,90,94,93,82,96,94,83,97,95,86,97,85,86,99,98,96,102,94,95,103,100,97,104,103,98,105,104,91,105,99,91,107,106,93,107,92,93,102,108,105,109,117,106,110,109,108,110,107,108,112,111,102,114,112,100,115,113,103,116,115,104,117,116,114,119,112,113,120,126,115,121,120,117,121,116,109,122,117,109,124,123,111,124,110,111,119,125,123,127,135,125,127,124,125,129,128,119,131,129,126,132,130,121,132,120,121,134,133,122,135,134,130,136,143,132,137,136,133,138,137,134,139,138,135,140,139,128,140,127,128,142,141,129,144,142,139,145,153,141,145,140,141,147,146,142,149,147,143,150,148,137,150,136,138,151,137,138,153,152,150,154,162,152,154,151,153,155,152,153,157,156,146,157,145,146,159,158,147,161,159,148,162,160,158,164,157,158,165,163,161,165,159,160,168,166,162,169,168,155,169,154,156,170,155,156,164,171,169,172,180,171,172,170,171,174,173,163,174,164,163,176,175,165,178,176,166,179,177,168,180,179,176,182,175,176,184,181,177,185,183,179,186,185,172,186,180,173,187,172,173,189,188,175,189,174,187,191,186,188,190,187,188,193,192,182,193,189,182,195,194,181,197,195,183,198,196,185,191,198,194,199,207,195,201,199,196,202,200,198,203,202,190,203,191,192,204,190,192,206,205,194,206,193,205,209,204,205,210,208,207,210,206,207,212,211,199,214,212,202,213,200,202,216,215,204,216,203,214,219,212,215,217,213,215,221,220,209,221,216,209,223,222,208,224,223,211,224,210,211,219,225,223,227,222,223,228,226,225,228,224,225,230,229,218,230,219,220,231,217,220,234,233,222,234,221,230,235,242,231,236,243,233,237,236,227,237,234,227,239,238,226,240,239,229,240,228,229,242,241,239,244,252,241,244,240,241,246,245,235,246,242,243,249,247,237,249,236,238,250,237,239,251,238,249,253,261,250,254,253,252,254,251,252,256,255,245,256,244,245,258,257,248,258,246,247,261,259,257,263,256,258,262,257,258,266,264,259,267,265,261,268,267,253,269,268,255,269,254,255,263,270,268,272,267,269,271,268,270,273,269,270,275,274,262,275,263,262,277,276,264,279,277,267,278,265,276,281,275,276,282,280,277,284,282,278,285,283,272,286,285,271,287,286,274,287,273,274,281,288,287,0,286,288,3,287,281,5,288,280,7,281,282,9,280,282,16,11,285,13,283,286,18,285,84,289,96,96,289,101,101,289,114,114,289,118,118,289,131,144,131,289,149,144,289,149,289,161,161,289,167,167,289,178,178,289,184,184,289,197,197,289,201,201,289,214,214,289,218,218,289,232,232,289,235,235,289,248,260,248,289,260,289,266,266,289,279,279,289,284,284,289,16,16,289,17,27,17,289,27,289,32,44,32,289,44,289,49,49,289,62,62,289,68,68,289,79,79,289,84];
	static var skydomePos = [-0.55557,0.0,0.83147,-0.544895,0.108386,0.83147,-0.37533,0.074658,0.92388,-0.707107,0.0,0.707107,-0.69352,0.13795,0.707107,-0.83147,0.0,0.55557,-0.815493,0.162212,0.55557,-0.92388,0.0,0.382683,-0.906127,0.18024,0.382683,-0.980785,0.0,0.19509,-0.96194,0.191342,0.19509,-1.0,0.0,0.0,-0.980785,0.19509,0.0,-0.19509,0.0,0.980785,-0.191342,0.03806,0.980785,0.0,0.0,1.,-0.980785,0.0,-0.28234,-0.96194,0.191342,-0.28234,-0.382683,0.0,0.92388,-0.353553,0.146447,0.92388,-0.51328,0.212608,0.83147,-0.653281,0.270598,0.707107,-0.768178,0.31819,0.55557,-0.853553,0.353553,0.382683,-0.906127,0.37533,0.19509,-0.923879,0.382684,0.0,-0.18024,0.074658,0.980785,-0.906127,0.37533,-0.28234,-0.768178,0.51328,0.382683,-0.815493,0.544895,0.19509,-0.831469,0.55557,0.0,-0.162212,0.108387,0.980785,-0.815493,0.544895,-0.28234,-0.31819,0.212608,0.92388,-0.46194,0.308658,0.83147,-0.587938,0.392848,0.707107,-0.691342,0.46194,0.55557,-0.392847,0.392848,0.83147,-0.5,0.5,0.707107,-0.587938,0.587938,0.55557,-0.653281,0.653282,0.382683,-0.69352,0.69352,0.19509,-0.707107,0.707107,0.0,-0.13795,0.13795,0.980785,-0.69352,0.69352,-0.28234,-0.270598,0.270598,0.92388,-0.544895,0.815493,0.19509,-0.55557,0.83147,0.0,-0.108386,0.162212,0.980785,-0.544895,0.815493,-0.28234,-0.212607,0.31819,0.92388,-0.308658,0.46194,0.83147,-0.392847,0.587938,0.707107,-0.46194,0.691342,0.55557,-0.51328,0.768178,0.382683,-0.212607,0.51328,0.83147,-0.270598,0.653282,0.707107,-0.318189,0.768178,0.55557,-0.353553,0.853554,0.382683,-0.37533,0.906128,0.19509,-0.382683,0.92388,0.0,-0.074658,0.18024,0.980785,-0.37533,0.906128,-0.28234,-0.146446,0.353554,0.92388,-0.191341,0.96194,0.19509,-0.18024,0.906128,0.382683,-0.19509,0.980785,0.0,-0.03806,0.191342,0.980785,-0.191341,0.96194,-0.28234,-0.074658,0.375331,0.92388,-0.108386,0.544895,0.83147,-0.137949,0.69352,0.707107,-0.162211,0.815493,0.55557,0.0,0.707107,0.707107,0.0,0.83147,0.55557,0.0,0.92388,0.382683,0.0,0.980785,0.19509,0.0,1.,0.0,0.0,0.195091,0.980785,0.0,0.980785,-0.28234,0.0,0.382684,0.92388,0.0,0.55557,0.83147,0.195091,0.980785,0.0,0.038061,0.191342,0.980785,0.191342,0.96194,-0.28234,0.074658,0.375331,0.92388,0.108387,0.544895,0.83147,0.13795,0.69352,0.707107,0.162212,0.815493,0.55557,0.18024,0.906128,0.382683,0.191342,0.96194,0.19509,0.31819,0.768178,0.55557,0.353554,0.853554,0.382683,0.375331,0.906127,0.19509,0.382684,0.92388,0.0,0.074658,0.18024,0.980785,0.375331,0.906127,-0.28234,0.146447,0.353554,0.92388,0.212608,0.51328,0.83147,0.270598,0.653282,0.707107,0.108387,0.162212,0.980785,0.544895,0.815493,-0.28234,0.555571,0.83147,0.0,0.212608,0.31819,0.92388,0.308659,0.46194,0.83147,0.392848,0.587938,0.707107,0.46194,0.691342,0.55557,0.51328,0.768178,0.382683,0.544895,0.815493,0.19509,0.587938,0.587938,0.55557,0.653282,0.653282,0.382683,0.69352,0.69352,0.19509,0.707107,0.707107,0.0,0.13795,0.13795,0.980785,0.69352,0.69352,-0.28234,0.270599,0.270598,0.92388,0.392848,0.392848,0.83147,0.5,0.5,0.707107,0.815493,0.544895,-0.28234,0.83147,0.55557,0.0,0.31819,0.212608,0.92388,0.46194,0.308658,0.83147,0.587938,0.392848,0.707107,0.691342,0.46194,0.55557,0.768178,0.51328,0.382683,0.815493,0.544895,0.19509,0.162212,0.108386,0.980785,0.853554,0.353553,0.382683,0.906128,0.37533,0.19509,0.92388,0.382683,0.0,0.18024,0.074658,0.980785,0.906128,0.37533,-0.28234,0.353554,0.146447,0.92388,0.51328,0.212608,0.83147,0.653282,0.270598,0.707107,0.768178,0.31819,0.55557,0.375331,0.074658,0.92388,0.544896,0.108386,0.83147,0.69352,0.13795,0.707107,0.815493,0.162212,0.55557,0.906128,0.18024,0.382683,0.96194,0.191342,0.19509,0.980786,0.19509,0.0,0.191342,0.03806,0.980785,0.96194,0.191342,-0.28234,0.92388,0.0,0.382683,0.980785,0.0,0.19509,1.,0.0,0.0,0.195091,0.0,0.980785,0.980785,0.0,-0.28234,0.382684,0.0,0.92388,0.555571,0.0,0.83147,0.707107,0.0,0.707107,0.83147,0.0,0.55557,0.544896,-0.108386,0.83147,0.69352,-0.13795,0.707107,0.815493,-0.162212,0.55557,0.906128,-0.18024,0.382683,0.96194,-0.191342,0.19509,0.980786,-0.19509,0.0,0.191342,-0.03806,0.980785,0.96194,-0.191342,-0.28234,0.375331,-0.074658,0.92388,0.906127,-0.37533,0.19509,0.853554,-0.353553,0.382683,0.92388,-0.382684,0.0,0.18024,-0.074658,0.980785,0.906127,-0.37533,-0.28234,0.353554,-0.146447,0.92388,0.51328,-0.212608,0.83147,0.653282,-0.270598,0.707107,0.768178,-0.31819,0.55557,0.587938,-0.392847,0.707107,0.691342,-0.46194,0.55557,0.768178,-0.51328,0.382683,0.815493,-0.544895,0.19509,0.83147,-0.55557,0.0,0.162212,-0.108386,0.980785,0.815493,-0.544895,-0.28234,0.31819,-0.212608,0.92388,0.46194,-0.308658,0.83147,0.707107,-0.707107,0.0,0.69352,-0.69352,0.19509,0.13795,-0.13795,0.980785,0.69352,-0.69352,-0.28234,0.270598,-0.270598,0.92388,0.392848,-0.392848,0.83147,0.5,-0.5,0.707107,0.587938,-0.587938,0.55557,0.653282,-0.653281,0.382683,0.392848,-0.587938,0.707107,0.308659,-0.46194,0.83147,0.46194,-0.691342,0.55557,0.51328,-0.768178,0.382683,0.544895,-0.815493,0.19509,0.55557,-0.83147,0.0,0.108387,-0.162212,0.980785,0.544895,-0.815493,-0.28234,0.212608,-0.31819,0.92388,0.382684,-0.92388,0.0,0.074658,-0.18024,0.980785,0.37533,-0.906127,-0.28234,0.146447,-0.353553,0.92388,0.212608,-0.51328,0.83147,0.270598,-0.653281,0.707107,0.31819,-0.768177,0.55557,0.353554,-0.853553,0.382683,0.37533,-0.906127,0.19509,0.162212,-0.815493,0.55557,0.13795,-0.69352,0.707107,0.18024,-0.906127,0.382683,0.191342,-0.961939,0.19509,0.19509,-0.980785,0.0,0.038061,-0.191342,0.980785,0.191342,-0.961939,-0.28234,0.074658,-0.37533,0.92388,0.108387,-0.544895,0.83147,0.0,-0.19509,0.980785,0.0,-0.980785,-0.28234,0.0,-1.0,0.0,0.0,-0.382683,0.92388,0.0,-0.55557,0.83147,0.0,-0.707107,0.707107,0.0,-0.831469,0.55557,0.0,-0.923879,0.382683,0.0,-0.980785,0.19509,-0.162211,-0.815493,0.55557,-0.137949,-0.69352,0.707107,-0.18024,-0.906127,0.382683,-0.191342,-0.961939,0.19509,-0.19509,-0.980785,0.0,-0.03806,-0.191342,0.980785,-0.191342,-0.961939,-0.28234,-0.074658,-0.37533,0.92388,-0.108386,-0.544895,0.83147,-0.37533,-0.906127,-0.28234,-0.146446,-0.353553,0.92388,-0.212607,-0.51328,0.83147,-0.270598,-0.653281,0.707107,-0.318189,-0.768177,0.55557,-0.353553,-0.853553,0.382683,-0.37533,-0.906127,0.19509,-0.382683,-0.923879,0.0,-0.074658,-0.18024,0.980785,-0.51328,-0.768178,0.382683,-0.544895,-0.815493,0.19509,-0.55557,-0.831469,0.0,-0.108386,-0.162212,0.980785,-0.544895,-0.815493,-0.28234,-0.212607,-0.31819,0.92388,-0.308658,-0.46194,0.83147,-0.392847,-0.587938,0.707107,-0.461939,-0.691341,0.55557,-0.392847,-0.392847,0.83147,-0.5,-0.5,0.707107,-0.587937,-0.587937,0.55557,-0.653281,-0.653281,0.382683,-0.693519,-0.693519,0.19509,-0.707106,-0.707106,0.0,-0.137949,-0.13795,0.980785,-0.693519,-0.693519,-0.28234,-0.270598,-0.270598,0.92388,-0.815492,-0.544895,0.19509,-0.768177,-0.51328,0.382683,-0.831469,-0.55557,0.0,-0.162211,-0.108386,0.980785,-0.815492,-0.544895,-0.28234,-0.318189,-0.212607,0.92388,-0.461939,-0.308658,0.83147,-0.587937,-0.392847,0.707107,-0.691341,-0.461939,0.55557,-0.51328,-0.212607,0.83147,-0.353553,-0.146447,0.92388,-0.653281,-0.270598,0.707107,-0.768177,-0.318189,0.55557,-0.853553,-0.353553,0.382683,-0.906127,-0.37533,0.19509,-0.923879,-0.382683,0.0,-0.18024,-0.074658,0.980785,-0.906127,-0.37533,-0.28234,-0.961939,-0.191341,0.19509,-0.906127,-0.18024,0.382683,-0.980785,-0.19509,0.0,-0.191342,-0.03806,0.980785,-0.961939,-0.191341,-0.28234,-0.37533,-0.074658,0.92388,-0.544895,-0.108386,0.83147,-0.69352,-0.13795,0.707107,-0.815492,-0.162211,0.55557,0.0,0.0,-0.860043];
	static var skydomeNor = [0.559771,0.0,-0.828639,0.548997,-0.109195,-0.828639,0.380413,-0.075655,-0.92169,0.710135,0.0,-0.704031,0.696493,-0.138524,-0.704031,0.833338,0.0,-0.552751,0.817316,-0.162572,-0.552751,0.924741,0.0,-0.380535,0.90698,-0.180395,-0.380535,0.980987,0.0,-0.193915,0.962157,-0.191382,-0.193915,0.999878,0.0,-0.015015,0.980651,-0.195044,-0.015015,0.200964,0.0,-0.979583,0.197089,-0.039186,-0.979583,0.0,0.0,-1.0,0.858486,0.0,0.512803,0.841975,-0.167455,0.512803,0.38786,0.0,-0.92169,0.358348,-0.148412,-0.92169,0.517136,-0.214209,-0.828639,0.656056,-0.271737,-0.704031,0.76989,-0.318888,-0.552751,0.854366,-0.353862,-0.380535,0.906339,-0.375408,-0.193915,0.923765,-0.382611,-0.015015,0.185644,-0.076907,-0.979583,0.793146,-0.328532,0.512803,0.768914,-0.513749,-0.380535,0.815668,-0.545,-0.193915,0.831355,-0.555498,-0.015015,0.167089,-0.111637,-0.979583,0.713797,-0.476943,0.512803,0.322489,-0.215491,-0.92169,0.465407,-0.310984,-0.828639,0.590442,-0.394513,-0.704031,0.692892,-0.462966,-0.552751,0.395795,-0.395795,-0.828639,0.502121,-0.502121,-0.704031,0.589251,-0.589251,-0.552751,0.65389,-0.65389,-0.380535,0.693655,-0.693655,-0.193915,0.707022,-0.707022,-0.015015,0.142094,-0.142094,-0.979583,0.607044,-0.607044,0.512803,0.27427,-0.27427,-0.92169,0.545,-0.815668,-0.193915,0.555498,-0.831355,-0.015015,0.111637,-0.167089,-0.979583,0.476943,-0.713797,0.512803,0.215491,-0.322489,-0.92169,0.310984,-0.465407,-0.828639,0.394513,-0.590442,-0.704031,0.462966,-0.692892,-0.552751,0.513749,-0.768914,-0.380535,0.214209,-0.517136,-0.828639,0.271737,-0.656056,-0.704031,0.318888,-0.76989,-0.552751,0.353862,-0.854366,-0.380535,0.375408,-0.906339,-0.193915,0.382611,-0.923765,-0.015015,0.076907,-0.185644,-0.979583,0.328532,-0.793146,0.512803,0.148412,-0.358348,-0.92169,0.191382,-0.962157,-0.193915,0.180395,-0.90698,-0.380535,0.195044,-0.980651,-0.015015,0.039186,-0.197089,-0.979583,0.167455,-0.841975,0.512803,0.075655,-0.380413,-0.92169,0.109195,-0.548997,-0.828639,0.138524,-0.696493,-0.704031,0.162572,-0.817316,-0.552751,0.0,-0.710135,-0.704031,0.0,-0.833338,-0.552751,0.0,-0.924741,-0.380535,0.0,-0.980987,-0.193915,0.0,-0.999878,-0.015015,0.0,-0.200964,-0.979583,0.0,-0.858486,0.512803,0.0,-0.38786,-0.92169,0.0,-0.559771,-0.828639,-0.195044,-0.980651,-0.015015,-0.039186,-0.197089,-0.979583,-0.167455,-0.841975,0.512803,-0.075655,-0.380413,-0.92169,-0.109195,-0.548997,-0.828639,-0.138524,-0.696493,-0.704031,-0.162572,-0.817316,-0.552751,-0.180395,-0.90698,-0.380535,-0.191382,-0.962157,-0.193915,-0.318888,-0.76989,-0.552751,-0.353862,-0.854366,-0.380535,-0.375408,-0.906339,-0.193915,-0.382611,-0.923765,-0.015015,-0.076907,-0.185644,-0.979583,-0.328532,-0.793146,0.512803,-0.148412,-0.358348,-0.92169,-0.214209,-0.517136,-0.828639,-0.271737,-0.656056,-0.704031,-0.111637,-0.167089,-0.979583,-0.476943,-0.713797,0.512803,-0.555498,-0.831355,-0.015015,-0.215491,-0.322489,-0.92169,-0.310984,-0.465407,-0.828639,-0.394513,-0.590442,-0.704031,-0.462966,-0.692892,-0.552751,-0.513749,-0.768914,-0.380535,-0.545,-0.815668,-0.193915,-0.589251,-0.589251,-0.552751,-0.65389,-0.65389,-0.380535,-0.693655,-0.693655,-0.193915,-0.707022,-0.707022,-0.015015,-0.142094,-0.142094,-0.979583,-0.607044,-0.607044,0.512803,-0.27427,-0.27427,-0.92169,-0.395795,-0.395795,-0.828639,-0.502121,-0.502121,-0.704031,-0.713797,-0.476943,0.512803,-0.831355,-0.555498,-0.015015,-0.322489,-0.215491,-0.92169,-0.465407,-0.310984,-0.828639,-0.590442,-0.394513,-0.704031,-0.692892,-0.462966,-0.552751,-0.768914,-0.513749,-0.380535,-0.815668,-0.545,-0.193915,-0.167089,-0.111637,-0.979583,-0.854366,-0.353862,-0.380535,-0.906339,-0.375408,-0.193915,-0.923765,-0.382611,-0.015015,-0.185644,-0.076907,-0.979583,-0.793146,-0.328532,0.512803,-0.358348,-0.148412,-0.92169,-0.517136,-0.214209,-0.828639,-0.656056,-0.271737,-0.704031,-0.76989,-0.318888,-0.552751,-0.380413,-0.075655,-0.92169,-0.548997,-0.109195,-0.828639,-0.696493,-0.138524,-0.704031,-0.817316,-0.162572,-0.552751,-0.90698,-0.180395,-0.380535,-0.962157,-0.191382,-0.193915,-0.980651,-0.195044,-0.015015,-0.197089,-0.039186,-0.979583,-0.841975,-0.167455,0.512803,-0.924741,0.0,-0.380535,-0.980987,0.0,-0.193915,-0.999878,0.0,-0.015015,-0.200964,0.0,-0.979583,-0.858486,0.0,0.512803,-0.38786,0.0,-0.92169,-0.559771,0.0,-0.828639,-0.710135,0.0,-0.704031,-0.833338,0.0,-0.552751,-0.548997,0.109195,-0.828639,-0.696493,0.138524,-0.704031,-0.817316,0.162572,-0.552751,-0.90698,0.180395,-0.380535,-0.962157,0.191382,-0.193915,-0.980651,0.195044,-0.015015,-0.197089,0.039186,-0.979583,-0.841975,0.167455,0.512803,-0.380413,0.075655,-0.92169,-0.906339,0.375408,-0.193915,-0.854366,0.353862,-0.380535,-0.923765,0.382611,-0.015015,-0.185644,0.076907,-0.979583,-0.793146,0.328532,0.512803,-0.358348,0.148412,-0.92169,-0.517136,0.214209,-0.828639,-0.656056,0.271737,-0.704031,-0.76989,0.318888,-0.552751,-0.590442,0.394513,-0.704031,-0.692892,0.462966,-0.552751,-0.768914,0.513749,-0.380535,-0.815668,0.545,-0.193915,-0.831355,0.555498,-0.015015,-0.167089,0.111637,-0.979583,-0.713797,0.476943,0.512803,-0.322489,0.215491,-0.92169,-0.465407,0.310984,-0.828639,-0.707022,0.707022,-0.015015,-0.693655,0.693655,-0.193915,-0.142094,0.142094,-0.979583,-0.607044,0.607044,0.512803,-0.27427,0.27427,-0.92169,-0.395795,0.395795,-0.828639,-0.502121,0.502121,-0.704031,-0.589251,0.589251,-0.552751,-0.65389,0.65389,-0.380535,-0.394513,0.590442,-0.704031,-0.310984,0.465407,-0.828639,-0.462966,0.692892,-0.552751,-0.513749,0.768914,-0.380535,-0.545,0.815668,-0.193915,-0.555498,0.831355,-0.015015,-0.111637,0.167089,-0.979583,-0.476943,0.713797,0.512803,-0.215491,0.322489,-0.92169,-0.382611,0.923765,-0.015015,-0.076907,0.185644,-0.979583,-0.328532,0.793146,0.512803,-0.148412,0.358348,-0.92169,-0.214209,0.517136,-0.828639,-0.271737,0.656056,-0.704031,-0.318888,0.76989,-0.552751,-0.353862,0.854366,-0.380535,-0.375408,0.906339,-0.193915,-0.162572,0.817316,-0.552751,-0.138524,0.696493,-0.704031,-0.180395,0.90698,-0.380535,-0.191382,0.962157,-0.193915,-0.195044,0.980651,-0.015015,-0.039186,0.197089,-0.979583,-0.167455,0.841975,0.512803,-0.075655,0.380413,-0.92169,-0.109195,0.548997,-0.828639,0.0,0.200964,-0.979583,0.0,0.858486,0.512803,0.0,0.999878,-0.015015,0.0,0.38786,-0.92169,0.0,0.559771,-0.828639,0.0,0.710135,-0.704031,0.0,0.833338,-0.552751,0.0,0.924741,-0.380535,0.0,0.980987,-0.193915,0.162572,0.817316,-0.552751,0.138524,0.696493,-0.704031,0.180395,0.90698,-0.380535,0.191382,0.962157,-0.193915,0.195044,0.980651,-0.015015,0.039186,0.197089,-0.979583,0.167455,0.841975,0.512803,0.075655,0.380413,-0.92169,0.109195,0.548997,-0.828639,0.328532,0.793146,0.512803,0.148412,0.358348,-0.92169,0.214209,0.517136,-0.828639,0.271737,0.656056,-0.704031,0.318888,0.76989,-0.552751,0.353862,0.854366,-0.380535,0.375408,0.906339,-0.193915,0.382611,0.923765,-0.015015,0.076907,0.185644,-0.979583,0.513749,0.768914,-0.380535,0.545,0.815668,-0.193915,0.555498,0.831355,-0.015015,0.111637,0.167089,-0.979583,0.476943,0.713797,0.512803,0.215491,0.322489,-0.92169,0.310984,0.465407,-0.828639,0.394513,0.590442,-0.704031,0.462966,0.692892,-0.552751,0.395795,0.395795,-0.828639,0.502121,0.502121,-0.704031,0.589251,0.589251,-0.552751,0.65389,0.65389,-0.380535,0.693655,0.693655,-0.193915,0.707022,0.707022,-0.015015,0.142094,0.142094,-0.979583,0.607044,0.607044,0.512803,0.27427,0.27427,-0.92169,0.815668,0.545,-0.193915,0.768914,0.513749,-0.380535,0.831355,0.555498,-0.015015,0.167089,0.111637,-0.979583,0.713797,0.476943,0.512803,0.322489,0.215491,-0.92169,0.465407,0.310984,-0.828639,0.590442,0.394513,-0.704031,0.692892,0.462966,-0.552751,0.517136,0.214209,-0.828639,0.358348,0.148412,-0.92169,0.656056,0.271737,-0.704031,0.76989,0.318888,-0.552751,0.854366,0.353862,-0.380535,0.906339,0.375408,-0.193915,0.923765,0.382611,-0.015015,0.185644,0.076907,-0.979583,0.793146,0.328532,0.512803,0.962157,0.191382,-0.193915,0.90698,0.180395,-0.380535,0.980651,0.195044,-0.015015,0.197089,0.039186,-0.979583,0.841975,0.167486,0.512803,0.380413,0.075655,-0.92169,0.548997,0.109195,-0.828639,0.696493,0.138524,-0.704031,0.817316,0.162572,-0.552751,0.0,0.0,0.999969];
}
